<?php
require("dbinfo.php");

$id = $_GET['id'];
$lat = $_GET['lat'];
$lng = $_GET['lng'];

//Abre a conexao com o banco MySql
$connection = mysql_connect(localhost, $username, $password);
if(!$connection){
	die('Nao conectado: ' . mysql_error());	
}

//Seleciona o banco de dados MySql
$db_selected = mysql_select_db($database, $connection);
if(!$db_selected){
	die('Nao eh possivel usar o DB: ' . mysql_error());	
}

//Atualiza a latitude
$query = "UPDATE objeto SET latitude = '" . $lat . "' WHERE id = " . $id;
$result = mysql_query($query);
if(!$result){
	die('Query Invalida: ' . mysql_error());	
}

//Atualiza a longitude
$query = "UPDATE objeto SET longitude = '" . $lng . "' WHERE id = " . $id;
$result = mysql_query($query);
if(!$result){
	die('Query Invalida: ' . mysql_error());	
}

mysql_close($connection);
?>